package com.dys.testjdk15;

/**
 * @className: com.dys.testjdk15.RecordTest
 * @description: com.dys.testjdk15
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/09/09 下午9:28
 */
public class RecordTest {
    /**
     * 这是一个main()方法,是应用程序的入口
     *
     * @param args 方法的形参列表,是一个字符串数组,包含了从命令行传递给程序的参数
     */
    public static void main(String[] args) {
        MyInter11 myInter1 = new Person1(10, "旋涡刘能");
    }
}

sealed interface MyInter11 {
    public void eat();
}

/*record 默认继承的 java.lang.Record
 * record可以直接实现密封接口,不需要用sealed 修饰 non-sealed 修饰
 * record本身是隐式的final修饰
 *
 * */

record Person1(Integer pid, String pname) implements MyInter11 {
    @Override
    public void eat() {

    }
}

record Student1(Integer pid, String pname) implements MyInter11 {
    @Override
    public void eat() {

    }
}

record Cook1(Integer pid, String pname) implements MyInter11 {
    @Override
    public void eat() {

    }
}

record Worker1(Integer pid, String pname) implements MyInter11 {
    @Override
    public void eat() {

    }
}